#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n = 0;
    cin >> n;
    vector<int> a(n);
    long long sum = 0, ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    for (int i = 0; i < n; i++)
    {
        sum -= a[i];
        ans += sum * a[i];
    }

    cout << ans << endl;
    return 0;
}